//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "TCreateCategoryForm.h"
#include "TMainForm.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TCreateCategoryForm *CreateCategoryForm;
//---------------------------------------------------------------------------
__fastcall TCreateCategoryForm::TCreateCategoryForm(TComponent* Owner) :
   TForm(Owner),
   Edit(false)
{
}
//---------------------------------------------------------------------------
void __fastcall TCreateCategoryForm::OkBtnClick(TObject *Sender)
{
  if (Edit)
    MainForm->IntegTV->Selected->Text = NameEdit->Text + ' ';
  else MainForm->IntegTV->Items->AddChild(MainForm->IntegTV->Selected,
         NameEdit->Text + ' ');
  Close();        
}
//---------------------------------------------------------------------------
void __fastcall TCreateCategoryForm::CancelBtnClick(TObject *Sender)
{
  Close();        
}
//---------------------------------------------------------------------------
void __fastcall TCreateCategoryForm::FormShow(TObject *Sender)
{
  if (Edit) {
    Caption = "Skyriaus pervadinimas";
    NameEdit->Text =
    MainForm->IntegTV->Selected->Text.SubString(1, MainForm->IntegTV->Selected->Text.Length() - 1);
  }
  else {
    Caption = "Naujas skyrius";
    NameEdit->Text = "Naujo skyriaus pavadinimas";
  }
}
//---------------------------------------------------------------------------




